std::unique_lock
From Cppreference
| C++ Standard Library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Thread support library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::unique_lock | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Defined in header <mutex>
| ||
| template< class Mutex >
class unique_lock; | (since C++11) | |
The class unique_lock implements general-purpose mutex ownership wrapper allowing deferred locking, timed locking, recursive locking, transfer of lock ownership, and use with condition variables. The class is non-copyable but movable.
Contents |
[edit] Member types
| Type | Definition |
| mutex_type | Mutex |
[edit] Member functions
| constructs a lock, optionally locking the supplied mutex (public member function) | |
| unlocks the associated mutex, if owned (public member function) | |
| unlocks the mutex, if owned, and acquires ownership of another (public member function) | |
Locking | |
| locks the associated mutex (public member function) | |
| tries to lock the associated mutex, returns if the mutex is not available (public member function) | |
| attempts to lock the associated TimedLockable mutex, returns if the mutex has been unavailable for the specified time duration (public member function) | |
| tries to lock the associated TimedLockable mutex, returns if the mutex has been unavailable until specified time point has been reached (public member function) | |
| unlocks the associated mutex (public member function) | |
Modifiers | |
| swaps state with another std::unique_lock (public member function) | |
| disassociates the associated mutex without unlocking it (public member function) | |
Observers | |
| returns a pointer to the associated mutex (public member function) | |
| tests whether the lock owns its associated mutex (public member function) | |
| tests whether the lock owns its associated mutex (public member function) | |
[edit] Non-member functions
| Specialization of std::swap for unique_locks (function template) | |